<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue HTML内容缩放工具</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            color: #333;
            min-height: 100vh;
            padding: 20px;
            line-height: 1.6;
        }
        
        .container {
            max-width: 1000px;
            margin: 0 auto;
            background: white;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }
        
        header {
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            color: white;
            padding: 25px;
            text-align: center;
        }
        
        h1 {
            font-size: 2.2rem;
            margin-bottom: 10px;
        }
        
        .subtitle {
            font-size: 1.1rem;
            opacity: 0.9;
        }
        
        .controls {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background: #f8f9fa;
            border-bottom: 1px solid #eaecef;
        }
        
        .btn-group {
            display: flex;
            gap: 12px;
        }
        
        .btn {
            padding: 12px 20px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .btn-primary {
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            color: white;
        }
        
        .btn-primary:hover {
            opacity: 0.9;
            transform: translateY(-2px);
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
        }
        
        .btn-outline {
            background: white;
            color: #2575fc;
            border: 2px solid #2575fc;
        }
        
        .btn-outline:hover {
            background: #f0f5ff;
        }
        
        .scale-info {
            font-size: 1.1rem;
            font-weight: 600;
            color: #2c3e50;
            background: white;
            padding: 10px 20px;
            border-radius: 6px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }
        
        .content-container {
            padding: 30px;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            min-height: 500px;
            overflow: auto;
        }
        
        .content {
            transition: transform 0.3s ease;
            transform-origin: top center;
            width: 80%;
            padding: 25px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
        }
        
        .content h2 {
            color: #2c3e50;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 2px solid #eaecef;
        }
        
        .content p {
            margin-bottom: 15px;
        }
        
        .content ul, .content ol {
            padding-left: 30px;
            margin-bottom: 20px;
        }
        
        .content li {
            margin-bottom: 8px;
        }
        
        .content blockquote {
            border-left: 4px solid #2575fc;
            padding-left: 20px;
            margin: 20px 0;
            font-style: italic;
            color: #555;
        }
        
        footer {
            text-align: center;
            padding: 20px;
            color: #666;
            font-size: 0.9rem;
            border-top: 1px solid #eaecef;
        }
        
        @media (max-width: 768px) {
            .controls {
                flex-direction: column;
                gap: 15px;
            }
            
            .content {
                width: 95%;
            }
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="container">
            <header>
                <h1>Vue HTML内容缩放工具</h1>
                <p class="subtitle">使用v-html渲染内容并实现缩放功能</p>
            </header>
            
            <div class="controls">
                <div class="btn-group">
                    <button class="btn btn-primary" @click="zoomOut">
                        <span>&#10134;</span> 缩小
                    </button>
                    <button class="btn btn-outline" @click="resetZoom">
                        <span>&#8635;</span> 重置
                    </button>
                    <button class="btn btn-primary" @click="zoomIn">
                        <span>&#10133;</span> 放大
                    </button>
                </div>
                
                <div class="scale-info">
                    当前缩放: {{ (scale * 100).toFixed(0) }}%
                </div>
            </div>
            
            <div class="content-container">
                <div class="content" :style="{ transform: `scale(${scale})` }" v-html="htmlContent"></div>
            </div>
            
            <footer>
                <p>Vue HTML缩放工具 &copy; 2023</p>
            </footer>
        </div>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                scale: 1,
                minScale: 0.5,
                maxScale: 2,
                scaleStep: 0.1,
                htmlContent: `
                    <h2>Vue v-html 内容渲染示例</h2>
                    <p>这是一个使用Vue的v-html指令渲染HTML内容的示例。您可以使用上面的控制按钮放大或缩小此内容。</p>
                    
                    <blockquote>
                        "这是一个引用区块，用于展示不同HTML元素的渲染效果。"
                    </blockquote>
                    
                    <p>缩放功能通过CSS的transform: scale()属性实现，提供了平滑的过渡动画。</p>
                    
                    <h3>功能特点：</h3>
                    <ul>
                        <li>使用Vue的v-html指令渲染HTML内容</li>
                        <li>放大、缩小和重置缩放比例</li>
                        <li>显示当前缩放百分比</li>
                        <li>平滑的缩放过渡动画</li>
                        <li>响应式设计，适应不同屏幕尺寸</li>
                    </ul>
                    
                    <h3>使用场景：</h3>
                    <ol>
                        <li>文档查看器</li>
                        <li>图片画廊</li>
                        <li>演示文稿</li>
                        <li>需要缩放功能的任何HTML内容</li>
                    </ol>
                    
                    <p>尝试使用放大和缩小按钮来查看效果！</p>
                `
            },
            methods: {
                zoomIn() {
                    if (this.scale < this.maxScale) {
                        this.scale += this.scaleStep;
                    }
                },
                zoomOut() {
                    if (this.scale > this.minScale) {
                        this.scale -= this.scaleStep;
                    }
                },
                resetZoom() {
                    this.scale = 1;
                }
            }
        });
    </script>
</body>
</html>